<!--#include file="conn.asp"-->
<link href="style.css" rel="stylesheet" type="text/css">
<%
if request.Cookies("huangfeng")("admin")="" then
response.write "<script LANGUAGE='javascript'>alert('对不起，还没有登陆');history.go(-1);</script>"
response.end
end if
function chkhtm(stra)
stra=replace(stra,"<","&lt;")
stra=replace(stra,">","&gt;")
stra=replace(stra,"'","")
stra=replace(stra,"(","（")
stra=replace(stra,")","）")
stra=replace(stra,";","；")
stra=replace(stra,",","，")
stra=replace(stra,"%","％")
stra=replace(stra,"+","＋")
chkhtm=stra
end function
'##########################################
if request.form("action")="new" then
lx_mt=chkhtm(trim(request.form("lx_mt")))
lx_yw=chkhtm(trim(request.form("lx_yw")))
if lx_mt="" then
response.write("<script LANGUAGE='javascript'>alert('对不起，所有信息不能为空');history.go(-1);</script>")
response.end
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from [gshclass]"
rs.open sql,conn,1,3
rs.addnew
rs("lx_mt")=lx_mt
rs("lx_yw")=lx_yw
rs.update
rs.close
set rs=nothing
Response.write "<script language = 'javascript'>alert('添加成功!');window.document.location.href='gshclass.asp';</script>"
response.end
end if
'################################
if request.form("action")="edit" then
lx_id=request.form("lx_id")
lx_mt=chkhtm(trim(request.form("lx_mt")))
lx_yw=chkhtm(trim(request.form("lx_yw")))
if lx_id="" or lx_mt="" then
response.write("<script LANGUAGE='javascript'>alert('对不起，所有信息不能为空');history.go(-1);</script>")
response.end
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from [gshclass] where lx_id="& lx_id &""
rs.open sql,conn,1,3
if not (rs.BOF and rs.EOF) then
rs.update
rs("lx_mt")=lx_mt
rs("lx_yw")=lx_yw
rs.update
rs.close
set rs=nothing
Response.write "<script language = 'javascript'>alert('修改成功!');window.document.location.href='gshclass.asp';</script>"
response.end
end if
end if
'#########################
if request.QueryString("action")="delp" then
if request.querystring("lx_id")="" then
response.write "<script LANGUAGE='javascript'>alert('对不起，文件为空');history.go(-1);</script>" 
  response.End
else
lx_id=request.querystring("lx_id")
set rs=server.CreateObject("adodb.recordset")
sql="delete from [gshclass] where lx_id="& lx_id &""
rs.open sql,conn,1,3
Response.write "<script language = 'javascript'>alert('成功删除了!');window.document.location.href='gshclass.asp';</script>"
response.end
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>分类管理</title>
<link href="../style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
a:link {
	color: #000000;
}
a:visited {
	color: #000000;
}
a:hover {
	color: #666666;
}
a:active {
	color: #666666;
}
-->
</style>

</head>

<body>

<table align="center" width="98%" border="1" cellspacing="0" cellpadding="4" bordercolor="#C0C0C0" style="border-collapse: collapse" class="xt">
        <tr> 
          <td bgcolor="#E8E8E8">文件管理</td>
		  <td bgcolor="#E8E8E8" colspan="3">&nbsp;</td>
        </tr>
        <tr bgcolor="#E8E8E8" align="center"> 
          <td class="xt" width="10%" bgcolor="#F5F5F5">编号</td>
          <td bgcolor="#F5F5F5" class="xt">案例分类名</td>
          <td class="xt" width="20%" bgcolor="#F5F5F5">操作</td>
        </tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from [gshclass] order by lx_id desc"
rs.open sql,conn,1,1
if not (rs.eof or rs.bof) then
pg=10
rs.pagesize= cint(pg)
		page_size=rs.pagesize
		page_no=request("page_no")
	    IF page_no="" Then
	      page_no=1
	    Else
	       page_no=page_no+1
           page_no=page_no-1
	    End IF
		Rs.pagesize=page_size
		page_total=Rs.pagecount
		Rs.absolutepage=page_no
do while not rs.eof and page_size>0
%>
        <tr> 
          
    <td bgcolor="#FFFFFF" class="xt" align="center"><%=rs("lx_id")%></td>
    <td bgcolor="#FFFFFF" class="xt">&nbsp;<%=left(rs("lx_mt"),25)%>&nbsp;</td>
    <td bgcolor="#FFFFFF" class="xt" align="center"><a href="gshclass.asp?lx_id=<%=rs("lx_id")%>&action=editp#editp">修改</a>
      <a href="gshclass.asp?lx_id=<%=rs("lx_id")%>&action=delp#delp">删除</a></td>
        </tr>
<%
rs.movenext
page_size=page_size-1                                              
loop 
rs.close
set rs=nothing
else
%>
        <tr align="center"> 
          <td bgcolor="#FFFFFF" colspan="3" class="xt">当前没有分类！</td>
        </tr>
<%rs.close
set rs=nothing
End if%>
</table>
      <table align="center" width="98%" border="0" cellspacing="0" cellpadding="0">
	    
        <tr>
          <td width="39%" height="30" align="left" class="xt">  <a href="gshclass.asp?lx_id=<%=lx_id%>&action=newp"><font color="#CC6633">新增文件</font></a>		  </td>
          <td width="61%" align="right" class="xt">[每页显示<font color="#FF0000"> <%=int(pg)%> </font>条]  [本页是<%=int(page_no)%>/<%=int(page_total)%>] [<a href="?page_no=1">第一页</a>]
              <%if int(page_no)>1 then%>
              [<a href="?page_no=<%=cstr(int(page_no-1))%>">前一页</a>]
              <%elseif int(page_no)<=1 then%>
              [<a href="?page_no=1">前一页</a>]
              <%end if%>
              <%if int(page_no)<int(page_total) then%>
              [<a href="?page_no=<%=cstr(int(page_no+1))%>">后一页</a>]
              <%elseif int(page_no)>=int(page_total) then%>
              [<a href="?page_no=<%=cstr(int(page_total))%>">后一页</a>]
              <%end if%>
              [<a href="?page_no=<%=page_total%>">最后一页</a>]</td>
        </tr>
      </table>

      <br>
	  
	  <!--------------------->
	   <%if request.QueryString("action")="newp" then%>
      <table align="center" width="98%" border="1" cellspacing="0" cellpadding="4" bordercolor="#C0C0C0" style="border-collapse: collapse">
        <form name="f2" method="post" action="gshclass.asp">
          <tr> 
            <td bgcolor="#E8E8E8" class=xt><a name="newp">新的文件</a></td>
          </tr>
         
          <tr>
            <td height="30" bgcolor="#FFFFFF" class="xt"><font color="ff6666">文件名称:</font>              
              <input name="lx_mt" type="text" size="50"></td>
          </tr>                
         	<tr>
            <td height="30" bgcolor="#FFFFFF" class="xt"><font color="ff6666">文件英文:</font>              
              <input name="lx_yw" type="text" id="lx_yw" size="50"></td>
          </tr>	 
          <tr> 
            <td bgcolor="#F5F5F5" class="xt" height="30" align="center">
              <input type="submit" name="Submit2" value="确定新增" class="button">
              <input type="reset" name="Reset" value="清空重填" class="button">            </td>
          </tr>
		  <input type="hidden" name="action" value="new">	
	    </form>
      </table>
<%End if
if request.QueryString("action")="editp" then
if request.querystring("lx_id")="" then
response.write "<script LANGUAGE='javascript'>alert('对不起，文件为空');history.go(-1);</script>" 
response.end  
End if
lx_id=request.querystring("lx_id")
sql="select * from [gshclass] where lx_id="&lx_id&""
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
 <table align="center" width="98%" border="1" cellspacing="0" cellpadding="4" bordercolor="#C0C0C0" style="border-collapse: collapse">
        <form name="f2" method="post" action=gshclass.asp>
          <tr> 
            <td bgcolor="#E8E8E8" class="xt"><a name="editp">修改文件</a></td>
          </tr>
        
          <tr>
            <td height="30" bgcolor="#FFFFFF" class="xt"><font color="ff6666">文件名称:</font>
            <input name="lx_mt" type="text" class="xt" value="<%=rs("lx_mt")%>" size="50" maxlength="50"></td>
          </tr>
		 <tr>
            <td height="30" bgcolor="#FFFFFF" class="xt"><font color="ff6666">文件名称:</font>
            <input name="lx_yw" type="text" class="xt" id="lx_yw" value="<%=rs("lx_yw")%>" size="50" maxlength="50"></td>
          </tr> 
		  <tr> 
            <td bgcolor="#F5F5F5" class="xt" height="30" align="center"> 
              <input type="submit" name="Submit" value="确定修改" class="button"> 
              <input type="reset" name="Reset" value="清空重填" class="button">            </td>
          </tr>
		  <input type="hidden" name="lx_id" value="<%=lx_id%>">
		  <input type="hidden" name="action" value="edit">
        </form>
</table>
	  <%
	rs.close
	set rs=nothing  
	  End if%>  
    </td>
  </tr>
  <tr> 
    <td colspan="3" height="1" background="images/dotlineh.gif"></td>
  </tr>
</table>